package com.itheima.Controller;

import com.itheima.domain.Orders;
import com.itheima.domain.User;
import com.itheima.service.UserSrvice;
import com.itheima.service.impl.UserServiceImpl;
import org.junit.Test;

import java.util.List;

public class UserController {
    private UserSrvice userSrvice = new UserServiceImpl();
    @Test
    public  void findUserAndOrders() {
        List<User> userList = userSrvice.findUserAndOrders();
        for (User user : userList) {
            System.out.println("用户名称:"+user.getUsername());
            List<Orders> ordersList = user.getOrdersList();
            for (Orders orders : ordersList) {
                System.out.println("订单编号:"+orders.getNumber());
            }
        }
    }
}
